package org.devio.takephoto.model;

import java.io.Serializable;

/**
 * Luban配置类
 * Author: crazycodeboy
 * Date: 2016/11/5 0007 20:10
 * Version:4.0.1
 * 技术博文：http://www.devio.org/
 * GitHub:https://github.com/crazycodeboy
 * Email:crazycodeboy@gmail.com
 */
public class LubanOptions implements Serializable {
    /**
     * 压缩到的最大大小，单位B
     */
    private int maxSize;
    private int maxPixel;

    /**
     * 是否启用像素压缩
     */
    private boolean enablePixelCompress = true;
    /**
     * 是否启用质量压缩
     */
    private boolean enableQualityCompress = true;

    /**
     * 是否保留原文件
     */
    private boolean enableReserveRaw = true;

    private LubanOptions() {
    }

    public int getMaxSize() {
        return maxSize;
    }

    public void setMaxSize(int maxSize) {
        this.maxSize = maxSize;
    }

    public int getMaxPixel() {
        return maxPixel;
    }

    public void setMaxPixel(int maxPixel) {
        this.maxPixel = maxPixel;
    }

    public boolean isEnablePixelCompress() {
        return enablePixelCompress;
    }

    public void setEnablePixelCompress(boolean enablePixelCompress) {
        this.enablePixelCompress = enablePixelCompress;
    }

    public boolean isEnableQualityCompress() {
        return enableQualityCompress;
    }

    public void setEnableQualityCompress(boolean enableQualityCompress) {
        this.enableQualityCompress = enableQualityCompress;
    }

    public boolean isEnableReserveRaw() {
        return enableReserveRaw;
    }

    public void setEnableReserveRaw(boolean enableReserveRaw) {
        this.enableReserveRaw = enableReserveRaw;
    }

    public static class Builder {
        private LubanOptions options;

        public Builder() {
            options = new LubanOptions();
        }

        public Builder setMaxSize(int maxSize) {
            options.setMaxSize(maxSize);
            return this;
        }

        public Builder setMaxPixel(int maxPixel) {
            options.setMaxPixel(maxPixel);
            return this;
        }


        public boolean isEnablePixelCompress() {
            return options.enablePixelCompress;
        }

        public void setEnablePixelCompress(boolean enablePixelCompress) {
            options.setEnablePixelCompress(enablePixelCompress);
        }

        public boolean isEnableQualityCompress() {
            return options.enableQualityCompress;
        }

        public void setEnableQualityCompress(boolean enableQualityCompress) {
            options.setEnableQualityCompress(enableQualityCompress);
        }

        public boolean isEnableReserveRaw() {
            return options.enableReserveRaw;
        }

        public void setEnableReserveRaw(boolean enableReserveRaw) {
            options.setEnableReserveRaw(enableReserveRaw);
        }

        public LubanOptions create() {
            return options;
        }
    }
}
